#include "stdafx.h"
#include "prop_pool.h"
#include "tiles_pool.h"

prop_pool_x::prop_pool_x()
{
    Init();
}

prop_pool_x::~prop_pool_x()
{
    Uninit();
}

bool prop_pool_x::Init()
{
    prop_base* prop = new prop_base;
    prop->type = prop_type_normal;
    prop->img = tiles_pool::getInstance()->get(3);
    m_pool[1] = prop;
    return true;
}

void prop_pool_x::Uninit()
{
    prop_pool_map::iterator it = m_pool.begin();
    prop_pool_map::iterator itEnd = m_pool.end();
    for (; it != itEnd; ++it)
    {
        if (it->second)
        {
            delete it->second;
        }
    }
    m_pool.clear();
}

bool prop_pool_x::GetPropInfo( prop_index id, prop_base& prop )
{
    prop_pool_map::iterator it = m_pool.find(id);
    if (it != m_pool.end())
    {
        prop = *(it->second);
        return true;
    }
    return false;
}

